package com.inno.subject.infra.rpc;


import com.inno.oss.api.OssFeignService;
import com.inno.oss.response.CommonReturnType;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author sean
 * Oss服务远程调用
 */
@Component
public class OssRpc {
    @Resource
    private OssFeignService ossFeignService;

    public String uploadFile(MultipartFile file) {
        CommonReturnType<String> response = this.ossFeignService.upload(file);
        if (response.getCode() != 200){
           throw new RuntimeException(response.getMessage());
        }
        return response.getContent();
    }

}
